import java.util.Arrays;
import java.util.Scanner;

public class lianXi103 {
    public static void main(String[] args) {
        Scanner input =new Scanner(System.in);
        System.out.print("请输入有几个班级：");
        int n=input.nextInt();
        boolean flag=true;

        int[] num=new int[1];
        int [] avg=new int[n];

        do {int i;
        for (i=0;i<n;i++){
            int sum=0;
            System.out.println("请输入第"+(i+1)+"班级人数：");
            int m=input.nextInt();
            int[][] scores=new int[n][m];
            System.out.println("请输入第"+(i+1)+"个班级的成绩");
            for (int j=0;j<m;j++){
                System.out.print("请输入第"+(i+1)+"个班级的第"+(j+1)+"个同学的成绩：");
                scores[i][j]=input.nextInt();
                sum+=scores[i][j];
                continue;
            }
            //System.out.println(sum/m);
            num=Arrays.copyOf(num,num.length+i+1);
            num[i]=m;
            avg[i]=(sum/m);
        }

            if (i==n){
                flag=false;
            }
        }while (flag);
        //System.out.println(Arrays.toString(avg));
        for (int i=0;i<n;i++){
            System.out.println("第"+(i+1)+"个班总共有"+num[i]+"人，的平均成绩是:"+avg[i]);
        }


    }
}
